package jude.java.money.beans;

import jude.java.money.beans.global.BaseBean;

public abstract class Ftp extends BaseBean {
	private static final long serialVersionUID = 3949244724770830507L;
	
	public Ftp() {
	}
	
	public Ftp(String host) {
		this.host = host;
	}
	
	public Ftp(String host, String usr, String pwd) {
		this.host = host;
		this.port = 21;
		this.usr = usr;
		this.pwd = pwd;
	}
	
	private String host;
	private int port;
	private String usr;
	private String pwd;
	
	public String getHost() {
		return host;
	}
	public void setHost(String host) {
		this.host = host;
	}
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}
	public String getUsr() {
		return usr;
	}
	public void setUsr(String usr) {
		this.usr = usr;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	
	/////////////////////////////////////////////////////////////////
	
	//ftp://029zd:888888@029zd.com/029zd/web/fup.asp
	public String toUrl() {
		StringBuilder sb = new StringBuilder("ftp://");
		sb.append(usr).append(":").append(pwd);
		sb.append("@").append(host);
		if (port != 21 && port != 0)
			sb.append(":").append(port);
		return sb.toString();
	}
	

	public void init(String host, String usr, String pwd) {
		this.host = host;
		this.port = 21;
		this.usr = usr;
		this.pwd = pwd;
	}
	
}
